﻿<!DOCTYPE html>
<html>
<head>
    <title>无标题页</title>
    <link type="text/css" href="../Skin/Plane/css/List.css" rel="stylesheet" />
    <script type="text/javascript" src="../Htc/jquery-1.11.2.min.js"></script>
    <script type="text/javascript" src="../Htc/Enter2Tab.js"></script>
    <script type="text/javascript" src="../Htc/Drop.js"></script>
    <script type="text/javascript" src="../Htc/DataPage.js"></script>
    <script type="text/javascript" src="../Htc/TableColumnSize.js"></script>
    <script type="text/javascript" src="../Htc/Manager.js"></script>
    <script type="text/javascript" src="../Htc/Calender.js"></script>
    <script type="text/javascript" src="../Htc/CustomForm.js"></script>

</head>
<body class="BodyManager">
    <script type="text/javascript" language="javascript">
        //删除参数
        var PageType = "@ViewBag.Pg.Type";	//原类型

        var PageDelPrompt = "@ViewBag.Pg.Sop.DEL_prompt";	//删除提示
        var DelType = "@ViewBag.Pg.Type";		//参数
        //跳转页参数
        var CurPage = 1;
        var OrderField = "@ViewBag.Pg.OrderField";
        var OrderType = @ViewBag.Pg.OrderType;
        var KeyFieldName = "@ViewBag.Pg.KeyFieldName";
        //增加修改参数
        var FileUrl = "@Html.Raw(ViewBag.Pg.FileUrl)";		//文件地址
        var PopEditWidth = "@ViewBag.Pg.PopEditWidth";	//宽度
        var PopEditHeight = "@ViewBag.Pg.PopEditHeight";	//高度
        var NewWindow = @ViewBag.Pg.NewWindow.ToString().ToLower();
        var AddText = "@ViewBag.Pg.AddText";
        var EditText = "@ViewBag.Pg.EditText";
        var ImportText = "@ViewBag.Pg.ImportText";
        var PromptInfo = "@ViewBag.Pg.PromptInfo";
        var UrlAddPara = "@Html.Raw(ViewBag.Pg.UrlAddPara)";
        var UrlEditPara = "@Html.Raw(ViewBag.Pg.UrlEditPara)";
        var LocateText = "@ViewBag.Pg.LocateText";
        var DataPageUrl = "@Html.Raw(ViewBag.DataPageUrl)";
        var DelUrl = "@Html.Raw(ViewBag.DelUrl)";
        var ImportUrl = "@Html.Raw(ViewBag.ImportUrl)";
        var ExportUrl = "@Html.Raw(ViewBag.ExportUrl)";
        var DataPageSubUrl = "@Html.Raw(ViewBag.DataPageSubUrl)";
        var CustomPara = "";
        var LocatePara = "@ViewBag.Pg.FirstCondition";
        
        $(document).ready(function () {
            BindMoveModal();
            $("#locateOk").click(function () { locate_OK(); return false; });
            $("#TabPage li").click(function () {
                $("#TabPage li").removeClass("select");
                $(this).addClass("select");
            });
            if ($("#TabPage li").length > 0)
                $("#TabPage li").eq(0).click();
            else
                GoPage(1);
        });
        function locate()//查询
        {
            form1.reset();
            ShowModal("popLocate", LocateText, "提示信息");
        }

        function locate_OK()//查询：确定
        {
            HideModal('popLocate');
            var para = "";
            //后台生成取值脚本
            @Html.Raw(ViewBag.Pg.LocateScript)

            if (document.getElementById("LocateCHK").checked)
                LocatePara += para;
            //else if(typeof(TabPage)!='undefined')//????/
            //	LocatePara=TabPage.GetActiveTab().name+para;
            else
                LocatePara = para;

            GoPage(CurPage);
        }

        @Html.Raw(ViewBag.Pg.Script)
    </script>

    <form id="form1">
        <!--按钮栏-->
        <div class="tools">
            <ul class="toolbar">
                @foreach (var button in ViewBag.Pg.Button)
                {
                    @Html.Raw(button)
                }
                @if (ViewBag.Pg.Sop.ADD)
                {
                    @Html.Raw(ViewBag.Pg.Sop.ADD_htm)
                    if (ViewBag.Pg.Sop.ADD_htm == "")
                    {
                        <li id="btn_add" onclick="add()"><div class="icon"></div>增加</li>
                    }
                }
                @if (ViewBag.Pg.Sop.EDIT)
                {
                    @Html.Raw(ViewBag.Pg.Sop.EDIT_htm)
                    if (ViewBag.Pg.Sop.EDIT_htm == "")
                    {
                        <li id="btn_mod" onclick="edit()"><div class="icon"></div>修改</li>
                    }
                }
                @if (ViewBag.Pg.FileUrl != "" && ViewBag.Pg.Sop.BROWSE && !ViewBag.Pg.Sop.EDIT)
                {
                    @Html.Raw(ViewBag.Pg.Sop.BROWSE_htm)
                    if (ViewBag.Pg.Sop.BROWSE_htm == "")
                    {
                        <li id="btn_browse" onclick="edit()"><div class="icon"></div>查看</li>
                    }
                }
                @if (ViewBag.Pg.Sop.DEL)
                {
                    @Html.Raw(ViewBag.Pg.Sop.DEL_htm)
                    if (ViewBag.Pg.Sop.DEL_htm == "")
                    {
                        <li id="btn_del" onclick="DelType=PageType;del(PageDelPrompt);"><div class="icon"></div>删除</li>
                    }
                }
                @if (ViewBag.Pg.Sop.IMPORT)
                {
                    @Html.Raw(ViewBag.Pg.Sop.IMPORT_htm)
                    if (ViewBag.Pg.Sop.IMPORT_htm == "")
                    {
                        <li id="btn_import" onclick="importXls()"><div class="icon"></div>导入</li>
                    }
                }
                @if (ViewBag.Pg.Sop.LOCATE)
                {
                    @Html.Raw(ViewBag.Pg.Sop.LOCATE_htm)
                    if (ViewBag.Pg.Sop.LOCATE_htm == "")
                    {
                        <li id="btn_locate" onclick="locate()"><div class="icon"></div>查询</li>
                    }
                }
                @if (ViewBag.Pg.Sop.EXPORT)
                {
                    @Html.Raw(ViewBag.Pg.Sop.EXPORT_htm)
                    if (ViewBag.Pg.Sop.EXPORT_htm == "")
                    {
                        <li id="btn_export" onclick="exportXls()"><div class="icon"></div>导出</li>
                    }
                }
            </ul>
        </div>
        <div class="ManagerContent">
            @if (ViewBag.Pg.Tab.Count > 0)
            {
                <div id="TabPage">
                    <ul>
                       @{ 
                        var i = 0;
                        foreach (var dr in ViewBag.Pg.Tab)
                        {
                            if (i++ == ViewBag.Pg.Tab.Count)
                            {
                                <li onclick="@dr.Value" class="liLast">@dr.Key</li>
                            }
                            else
                            {
                               <li onclick="@dr.Value">@dr.Key</li>
                            }
                        }
                        }
                    </ul>
                </div>
            }
            <!--数据表格栏-->
            @if (ViewBag.DataPageSubUrl == "")
            {
                <div id="dgrid"></div>
            }
            @if (ViewBag.DataPageSubUrl != "")
            {
                <table class="multTable">
                    <tr valign=top>
                        <td style="width:100%"><div id="dgrid"></div></td>
                        <td><div id="dgridSub"></div></td>
                    </tr>
                </table>
            }

            <!--分页-->
            <div id="DataPageHTML"></div>
        </div>

        <!-- 弹出框 -->
        <table class="modal" id="popEdit">
            <tr>
                <td>
                    <div class="modal-content">
                        <table class="modal-header">
                            <tr>
                                <td class="modal-title">增加修改</td>
                                <td class="modal-close"><img src="../Skin/Plane/images/closeWhite.png" /></td>
                            </tr>
                        </table>
                        <div class="modal-body-shade"></div>
                        <div class="modal-body">

                        </div>
                        <div class="modal-footer" id="popEditPrompt">提示信息</div>
                    </div>
                </td>
            </tr>
        </table>

        <table class="modal" id="popLocate">
            <tr>
                <td>
                    <div class="modal-content">
                        <table class="modal-header">
                            <tr>
                                <td class="modal-title">查询</td>
                                <td class="modal-close"><img src="../Skin/Plane/images/closeWhite.png" /></td>
                            </tr>
                        </table>
                        <div class="modal-body-shade"></div>
                        <div class="modal-body">
                            <div class="LocateTable">
                                <table>
                                    @for (int i = 0; i < ViewBag.Pg.LocateTable.Count; i++)
                                    {
                                        if (i % ViewBag.Pg.ConditionColumn == 0)
                                        {
                                            @Html.Raw("<tr>")
                                        }
                                        <td>@Html.Raw(ViewBag.Pg.LocateTable[i][1])</td>
                                        <td>@Html.Raw(ViewBag.Pg.LocateTable[i][2])</td>
                                        if (i % ViewBag.Pg.ConditionColumn == ViewBag.Pg.ConditionColumn - 1)
                                        {
                                            @Html.Raw("</tr>")
                                        }
                                    }
                                    @{
                                        int k = ViewBag.Pg.LocateTable.Count % ViewBag.Pg.ConditionColumn;
                                        int m = ViewBag.Pg.ConditionColumn - k;
                                        if (k > 0)
                                        {
                                            @Html.Raw("<td colspan=" + m + "></td></tr>")
                                        }
                                    }
                                </table>
        </div>
        <input type="checkbox" id="LocateCHK" /><label for="LocateCHK">在结果中查询</label>
        <div class="LocateButton">
            <button id="locateOk" class="btn btnSubmit">确定</button>
            <button class="btn btnClose" onclick="HideModal('popLocate');return false;">关闭</button>
        </div>
        </div>
        <div class="modal-footer">提示信息</div>
        </div>
        </td></tr></table>
        <div class="modal-back"></div>

    </form>

</body>
</html>
